<!-- head -->
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-md-12">
        <ol class="breadcrumb">
            <li><a>主页</a></li>
            <li><a>代理商管理/代理商活动/代理商活动配置</a></li>
            <li class="active"><strong>代理商子活动配置</strong></li>
        </ol>
    </div>
</div>
<style type="text/css">
    .inputStyleMy {
        width:100px;margin:2px 0px 2px 0px;display:inline;
    }
    .textStyleMy {
        margin:7px 10px 7px 10px;display:inline;
    }
    .selectStyleMy {
        width:80px;margin:2px 0px 2px 0px;display:inline;
    }
</style>
<!-- content-->
<div class="wrapper wrapper-content animated fadeIn" ng-controller="agentActivityDetailSaveCtrl">
    <form class="form-horizontal" id="form1" name="horizontalCard">
        <div class="form-group">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div class="ibox-title">
                        <h5>规则设置</h5>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">活动类型:</label>
                            <div class="col-sm-2 checkbox" style="margin-left: 7px;" ng-bind="addInfo.actType | formatDropping:actTypeSelect"></div>
                        </div>
                        <div ng-if="addInfo.actType==1">
                            <!-- 百团 -->
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><i class="red_req">*</i>榜单规则设置:</label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">活动期间，名下</span>
                                    <select class="selectStyleMy form-control" disabled name="subMerchant" required ng-model="addInfo.activeExtMap.subMerchant" ng-options="x.value as x.text for x in agentSelect"/>
                                    <span class="textStyleMy">商户参与活动 ≥ </span>
                                    <input type="text" class="inputStyleMy form-control" ng-disabled="isDetail" name="merchantNum" required ng-model="addInfo.activeExtMap.merchantNum" placeholder="请输入人数">
                                    <span class="textStyleMy">人且牛气值排名前</span>
                                    <input type="text" class="inputStyleMy form-control" ng-disabled="isDetail" name="aatTop" required ng-model="addInfo.activeExtMap.aatTop" placeholder="请输入名次">
                                    <span class="textStyleMy">名（包含）可上榜</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"></label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">牛气值越高，排名越前，牛气值相同的情况下，参与商户数多的排前；</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"></label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">牛气值、参与商户数都相同的情况下，参与商户交易额大的排前；</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"></label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">牛气值、参与商户数、交易额都相同的情况下，代理商注册时间早的排前。</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><i class="red_req">*</i>牛气值公式:</label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">活动期间，名下</span>
                                    <select class="selectStyleMy form-control" disabled name="subMerchantActivity" required ng-model="addInfo.activeExtMap.subMerchantActivity" ng-options="x.value as x.text for x in agentSelect"/>
                                    <span class="textStyleMy">商户参与活动的人数 / </span>
                                    <select class="selectStyleMy form-control" disabled name="subMerchantTrans" required ng-model="addInfo.activeExtMap.subMerchantTrans" ng-options="x.value as x.text for x in agentSelect"/>
                                    <span class="textStyleMy">商户交易人数 X </span>
                                    <input type="text" class="inputStyleMy form-control" ng-disabled="isDetail" name="coefficient1" required ng-model="addInfo.activeExtMap.coefficient1" placeholder="系数">
                                    <span class="textStyleMy"> X </span>
                                    <input type="text" class="inputStyleMy form-control" ng-disabled="isDetail" name="coefficient2" required ng-model="addInfo.activeExtMap.coefficient2" placeholder="系数">
                                </div>
                            </div>
                        </div>

                        <div ng-if="addInfo.actType==2">
                            <!-- 千团 -->
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><i class="red_req">*</i>榜单规则设置:</label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">壕气值排名前</span>
                                    <input type="text" class="inputStyleMy form-control" ng-disabled="isDetail" name="aatTop" required ng-model="addInfo.activeExtMap.aatTop" placeholder="请输入名次">
                                    <span class="textStyleMy">名（包含）可上榜，壕气值越高，越排前；</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"></label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">壕气值相同的情况下，参与率高的排前；</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"></label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">壕气值、参与率都相同的情况下，参与商户数多的排前；</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"></label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">壕气值、参与率、参与商户数都相同的情况下，代理商注册时间早的排前。</span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><i class="red_req">*</i>壕气值公式:</label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">活动期间，名下</span>
                                    <select class="selectStyleMy form-control" disabled name="subPrideMerchant" required ng-model="addInfo.activeExtMap.subPrideMerchant" ng-options="x.value as x.text for x in agentSelect"/>
                                    <span class="textStyleMy">商户参与活动总交易额（单位：千万） X </span>
                                    <input type="text" class="inputStyleMy form-control" ng-disabled="isDetail" name="coefficient" required ng-model="addInfo.activeExtMap.coefficient" placeholder="系数">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label"><i class="red_req">*</i>参与率公式:</label>
                                <div class="col-sm-11">
                                    <span class="textStyleMy">活动期间，名下</span>
                                    <select class="selectStyleMy form-control" disabled name="subMerchantActivity" required ng-model="addInfo.activeExtMap.subMerchantActivity" ng-options="x.value as x.text for x in agentSelect"/>
                                    <span class="textStyleMy">商户参与活动的人数 / 名下</span>
                                    <select class="selectStyleMy form-control" disabled name="subMerchantTrans" required ng-model="addInfo.activeExtMap.subMerchantTrans" ng-options="x.value as x.text for x in agentSelect"/>
                                    <span class="textStyleMy">商户交易人数</span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--奖项设置-->
                    <div class="ibox-title">
                        <h5>奖项设置</h5>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <div class="col-sm-10" ng-show="!isDetail">
                                <button style="float: right;" class="btn btn-primary10 btn-mr20" type="button" ng-click="deleteRewardBatch()" >批量删除</button>
                                <button style="float: right;" class="btn btn-primary5 btn-mr20" type="button" ng-click="modalShow()" >新增奖项</button>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label"></label>
                            <div class="col-sm-9">
                                <div class="gridStyle" style="height:430px;" ui-grid="userGrid"
                                     ui-grid-selection ui-grid-resize-columns ui-grid-pinning></div>
                            </div>
                        </div>
                    </div>
                    <!--其它设置-->
                    <div class="ibox-title">
                        <h5>其它设置</h5>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">排行榜说明:</label>
                            <div class="col-sm-7">
                                <textarea class="form-control" rows="4" cols="15" ng-disabled="isDetail" ng-model="addInfo.rankDesc" placeholder="不超过50个字" maxlength="50"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">数据看板说明:</label>
                            <div class="col-sm-7">
                                <textarea class="form-control" rows="4" cols="15" ng-disabled="isDetail" ng-model="addInfo.dataDesc" placeholder="不超过30个字" maxlength="30"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-12 bgff">
                <div class="col-sm-12">
                    <div class="col-lg-3"></div>
                    <div class="col-sm-6">
                        <button class="btn btn-primary btn-mr20" type="button" ng-show="!isDetail" ng-click="saveInfo()" ng-disabled="horizontalCard.$invalid || submitting">提交</button>
                        <a class="btn btn-primary4" ng-click="toBack()"  >返回</a>
                    </div>
                </div>
            </div>
        </div>
    </form>

    <!-- data-backdrop="static" 禁用模态框点击外部关闭-->
    <div id="appModal" class="modal fade form-horizontal" tabindex="4" role="dialog" data-backdrop="static">
        <div class="modal-dialog" style="height:450px;width: 900px">
            <div class="modal-content" >
                <form class="form-horizontal" name="horizontalCardAdd" novalidate>
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h3 class="modal-title">{{title}}</h3>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i class="red_req">*</i>领取名次:</label>
                            <div class="col-sm-5">
                                <span class="textStyleMy">第</span>
                                <input type="text" class="selectStyleMy form-control" name="rankSeqStart" required ng-model="rewardInfo.rankSeqStart">
                                <span class="textStyleMy" ng-show="!idEdit"> - </span>
                                <input type="text" ng-show="!idEdit" class="selectStyleMy form-control" name="rankSeqEnd" required ng-model="rewardInfo.rankSeqEnd">
                                <span class="textStyleMy">名</span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i class="red_req">*</i>奖项名称:</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" name="rewardName" required ng-model="rewardInfo.rewardName">
                                <div class="req_mesg" ng-show="horizontalCardAdd.rewardName.$dirty && horizontalCard.rewardName.$invalid">
                                    <span ng-show="horizontalCardAdd.rewardName.$error.required">奖项名称不能为空</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><i class="red_req">*</i>奖项类型:</label>
                            <div class="col-sm-3">
                                <select class="form-control" name="rewardType"required ng-model="rewardInfo.rewardType"
                                        ng-change="rewardTypeChange()" ng-options="x.value as x.text for x in rewardTypeSelect"/>
                                <div class="req_mesg" ng-show="horizontalCardAdd.rewardType.$dirty && horizontalCard.rewardType.$invalid">
                                    <span ng-show="horizontalCardAdd.rewardType.$error.required">奖项名称不能为空</span>
                                </div>
                            </div>
                        </div>
                        <div ng-if="rewardInfo.rewardType==1">
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><i class="red_req">*</i>现金类型:</label>
                                <div class="col-sm-3">
                                    <select class="form-control" name="calcType" required ng-model="rewardInfo.calcType"
                                            ng-change="calcTypeChange()" ng-options="x.value as x.text for x in calcTypeSelect1"/>
                                    <div class="req_mesg" ng-show="horizontalCardAdd.calcType.$dirty && horizontalCard.calcType.$invalid">
                                        <span ng-show="horizontalCardAdd.calcType.$error.required">奖项名称不能为空</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group" >
                                <label class="col-sm-2 control-label"><i class="red_req">*</i>奖励金额:</label>
                                <div class="col-sm-10" ng-if="rewardInfo.calcType==1">
                                    <input type="text" class="inputStyleMy form-control" name="rewardNum" required ng-model="rewardInfo.rewardNum">
                                    <span class="textStyleMy">元</span>
                                    <div class="req_mesg" ng-show="horizontalCardAdd.rewardNum.$dirty && horizontalCard.rewardNum.$invalid">
                                        <span ng-show="horizontalCardAdd.rewardNum.$error.required">值不能为空</span>
                                    </div>
                                </div>
                                <div class="col-sm-105" ng-if="rewardInfo.calcType==2">
                                    <span class="textStyleMy">悬赏金</span>
                                    <input type="text" class="inputStyleMy form-control" name="rewardNum" required ng-model="rewardInfo.rewardNum" >
                                    <span class="textStyleMy">元 X 参与率</span>
                                    <div class="req_mesg" ng-show="horizontalCardAdd.rewardNum.$dirty && horizontalCard.rewardNum.$invalid">
                                        <span ng-show="horizontalCardAdd.rewardNum.$error.required">值不能为空</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <div class="form-group control-label">
                            <label class="col-sm-1 control-label"></label>
                            <div class="col-sm-6">
                                <button class="btn btn-primary btn-mr20" ng-disabled="horizontalCardAdd.$invalid" type="button" ng-click='saveRewardInfo()' >确定</button>
                                <button class="btn btn-primary4" type="button" ng-click='modalcancel()'>关闭</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>